package dapps.service.monitor;

import java.util.List;

import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.orm.hibernate.EntityManager;

import dapps.dao.monitor.ElementDao;
import dapps.dao.monitor.TypeDao;
import dapps.entity.monitor.Element;
import dapps.entity.user.Type;

@Service
// 默认将类中的所有函数纳入事务管理.
@Transactional
public class ElementManager extends EntityManager<Element, Long> {
	@Autowired
	private ElementDao eDao;
	
	@Autowired
	private TypeDao tDao;

	@Override
	protected ElementDao getEntityDao() {
		return eDao;
	}
	
	@Override
	public void delete(Long id) {
		eDao.delete(id);
	}
	
	public void delete(Element t) {
		eDao.delete(t);
	}
	public List<Type> getTypelist(Criterion[] criterions,String[] alias,Order[] orders) {
		return tDao.findByCriteria(null, criterions, alias, orders);
	}

}
